using MicroMsg.Manager;
using MicroMsg.Storage;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class VisiGroupContactCtrl : UserControl
	{
		public delegate void ListItemClick(object sender, object object_0);
		private const string TAG = "VisiGroupContactCtrl";
		public static DependencyProperty ItemObjectProperty = DependencyProperty.Register("ItemObject", typeof(Contact), typeof(VisiGroupContactCtrl), new PropertyMetadata(null, new PropertyChangedCallback(VisiGroupContactCtrl.OnItemObjectPropertyChanged)));
		internal ContactHeadCtrl headCtrl;
		internal EmojiText txBkTitle;
		internal EmojiText txBkSignature;
		private bool _contentLoaded;
		public event VisiGroupContactCtrl.ListItemClick ItemClick;
		public Contact ItemObject
		{
			get
			{
				return (Contact)base.GetValue(VisiGroupContactCtrl.ItemObjectProperty);
			}
			set
			{
				base.SetValue(VisiGroupContactCtrl.ItemObjectProperty, value);
			}
		}
		public VisiGroupContactCtrl()
		{
			this.InitializeComponent();
		}
		private static void OnItemObjectPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == VisiGroupContactCtrl.ItemObjectProperty)
			{
				(dependencyObject_0 as VisiGroupContactCtrl).ItemObjectPropertyChanged(dependencyPropertyChangedEventArgs_0);
			}
		}
		private void ItemObjectPropertyChanged(DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_OldValue() != dependencyPropertyChangedEventArgs_0.get_NewValue())
			{
				this.RefreshItem();
			}
		}
		private void btnLayoutRoot_Click(object sender, RoutedEventArgs e)
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, this.ItemObject);
			}
		}
		private void RefreshItem()
		{
			if (this.ItemObject == null)
			{
				return;
			}
			this.txBkTitle.Text = ContactHelper.getDisplayName(this.ItemObject.strUsrName, this.ItemObject);
			this.txBkSignature.Text = this.ItemObject.strSignature;
			this.headCtrl.mContact = this.ItemObject;
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Sns/Common/UI/SnsGroup/VisiGroupContactCtrl.xaml", 2));
			this.headCtrl = (ContactHeadCtrl)base.FindName("headCtrl");
			this.txBkTitle = (EmojiText)base.FindName("txBkTitle");
			this.txBkSignature = (EmojiText)base.FindName("txBkSignature");
		}
	}
}
